Приложение
2
Коды
основных файлов проекта "MyMail"
Данное приложение
является дополнением главы 16, представляющей описание проекта "MyMail",
и предназначено для демонстрации кода основных файлов данного проекта, в частности:
Application.cfm, main.js, selectchecks.js, main.css, ie.css, login.cfm, signup.cfm,
sendpassword.cfm, edituser.cfm, mailbox.cfm, receiving_mail.cfm, movedel_mail.cfm,
emptydel.cfm, view_mail.cfm,
properties_mail.cfm, newmail.cfm, addresses.cfm, addeditdel_addr.cfm,
deletesel_addr.cfm, logout.cfm.
Листинг
П2.1. Код конфигурационного файла Application.cfm
<CFAPPLICATION
NAME="MyMail"
APPLICATIONTIMEOUT="#createTimeSpan(0,1,0,0)1"
SESSIONTIMEOUT="#createTimeSpan(0,0,20,0)1"
SESSIONMANAGEMENT="Yes"
CLIENTMANAGEMENT="Yes"
SETCLIENTCOOKIES="Yes"
CLIENTSTORAGE="registry">
<!--- Определение
значения цвета фона (myBGColor) --->
<CFPARAM
NAME="application.myBGColor" DEFAULT="FFFFFF">
<!--- Добавление
стилей (Add Stylesheet) --->
<link rel="STYLESHEET"
type="text/css" href="main.css">
<script type="text/javascript" language="JavaScript"
src="main. js"></script>
<!--- Конфигурирование
БД (Database configuration) --->
<CFPAPxAM
NAME="application.dsn" DEFAULT="MyMail">
<!-----SMTP----->
<CFPARAM
NAME="application.smtp" DEFAULT="192.168.3.68">
<!----pop---->
<CFPARAM
NAME="application.pop" r>F,FAOLT="192 .168 . 3 . 60">
<!---Mail
Seiver--->
<CFPARAM
NAME="application.mailserver" DEFAULT="@MyMail">
<!--- Сообщения
об ошибках (Message Errors) --->
<CFPARAM
NAME="application.msgErrorLogin"
DEFAULT="You
have entered not the correct data!">
<CFPARAM NAME="application.msgErrorl"
DEFAULT="Login
should consist from more than 3 symbols">
<CFPARAM NAME="application.msgError2"
DEFAULT="Password
should consist from more than 4 symbols">
<CFPARAM NAME="application.msgError3"
DEFAULT="Password
should not consist only of numbers">
<CFPARAM NAME="application.msgError4"
DEFAULT="Password
and Confirm, should be identical">
<CFPARAM NAME="application.msgError5"
DEFAULT="First
Name, should not be empty">
<CFPARAM NAME="application.msgError6"
DEFAULT="Last
Name, should not be empty">
<!--- Параметры
страниц (Parameters of pages) --->
<CFPARAM
NAME="application.PageRows" DEFAULT="7">
<CFPARAM NAME="application.MaxLinePages" DEFAULT="12">
Листинг
П2.2. Код файла main.js
var ns = (document.layers)?
true:false
var ie = (document.all)? true:false
if (ie) {document.write('<clink
rel="stylesheet"
type="text/css"
href="ie.ess" title="master">');}
function layerWrite(id,nestref,
text) {
if (ns) {
var lyr = (nestref)?
eval('document.'+nestref+'.document.'+id+'.document')
:
document.layers[id].document
lyr.open()
lyr.write(text)
lyr.close()
}
else if (ie) document.all[id].innerHTML = text
}
Листинг
П2.3. Код файла selectchecks.js
function SelUnsellnv
(block) {
if (ns) var
idxlen =
document . layers [block] . document . form2 . elements . length;
else var idxlen
= document . form2 .elements . length;
return idxlen;
}
function SelectAll (block) {
idxlen = SelUnsellnv
(block) ;
for (i=0;i<idxlen;i++)
{
if(ns) document,
layers [block] .document. form2. elements [i] .checked=true;
else document
. form2 .elements (i) .checked = true;
}
function UnselectAll
(block) {
idxlen = SelUnsellnv (block) ;
for (i=0;i<idxlen;i++) {
if(ns) document,
layers [block] .document. form2. elements [i] . checked=false;
else document.
form2. elements (i) .checked = false;
}
}
function InvertChecks
(block) {
idxlen = SelUnsellnv (block) ;
for (i=0;i<idxlen;i++) {
if(ns) {
if
(document . layers [block] .document . form2 .elements [i] . checked==true)
{
document . layers
[block] .document. form2 . elements [i] . checked=false;
} else {
document . layers [block] .document . form2 . elements [i] . checked=true;
} else {
i Г* (document.form2.elements
(i) ..checked==true)
document.form2.elements(i).checked
= false;
} else {
document.form2.elements(i).checked
= true;
}
}
}
}
Листинг
П2.4. Код файла main. ess
A {color:#4B4558;}
A:hover {color:
I3366CC; text-decoration : underline;}
.txtmenu {
color : #4B4558;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
12px;
}
.txtmenustat
{
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
I
font-size : 12px;
padding : 3px;
color : I4B4558;
}
.txtprompt {"
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
color : I4B4558;
}
.title {
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight
: bold;
font-size : 17px;
color : I4B4558;
}
.txtForml {
padding : Opx;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
color : Black;
}
INPUT {
padding : 0px;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
}
TEXTAREA {
padding : 0px;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
}
.txtError {
padding : Opx;
font-family
: Verdana, Geneva, Arial;
font-size :
llpx;
color : Maroon;
}
.txt {
padding : 0px;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
color : Black;
}
.txtsearch {
padding : 0px;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
background :
Ie6e4dd;
text-decoration
: none;
}
.txtlink {
padding : Opx;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
color : #122C6D;
}
.txtact {
padding : 0px;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
color : #3366CC;
}
.note {
color : #BOB368;
}
#nenu {position:absolute;
left:10; top:30; width:550; height:20;
margin:0;z-index:1;}
#prompt {position:absolute;
left:10; top:50; width:300;
height:30;margin:0;z-index:1;}
#basic {position:absolute;
left:10; top:70; width:100%;
height:30;margin:0;z-index:1;}
#seladdr {position:absolute;
left:10; top:-400; width:550; height:350;
z-index:2; }
Листинг
П2.5. Код файла ie.css
.txtmenu {
color : #4B4558;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
padding : 3px;
text-decoration
: none;
font-weight
: bold;
}
.txtmenustat {
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
padding : 3px;
color : #4B4558;
.title {
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight : bold;
font-size : 15px;
color : #484558;
}
INPUT {
padding : 0px;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
10px;
}
TEXTAREA {
padding : 0px;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
10px;
}
.txtlink {
padding : 0px;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : llpx;
color : I122C6D;
text-decoration : none;
}
.txtact {
padding : Opx;
font-family
: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size :
llpx;
color : #3366CC;
text-decoration
: none;
Листинг
П2.6. Код страницы login.cfm
<HTML>
<HEAD>
<TITLE>Login</TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>#Application.myBGColor#</cfoutput>">
<script>
function SendPassword()
{
if(ie) var EMail
= document . forml .EMail_User. value;
else var EMail
=
document. layers [ 'basic' ] .document. forml .EMail_User. value;
if (EMail=="")
{
alert ('Enter
please Login (E-mail) ');
} else {
location. href
="sendpas sword. cfm?EMail="+EMail;
}
</script>
<CFIF IsDefined(
"Session. user. id") AND Session. login eq "true">
< ! --- Пользователь уже существует
(The user is
already determined) --- >
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=MailBox.cfm">
<CFELSE>
<CFIF isDefined("Form.EMail_User")
AND isDefinedC'Form. Pass_User") >
<! --- Проверка (Verification) --- >
<CFQUERY
NAME="VerificationUser" DATASOURCE="#Application.dsn#">
SELECT Key_User, FirstN_User, LastN_User,
EMail_User,
TotalLogins_User, Pass_User
FROM UserMail
WHERE EMail_User
= '#Form.EMail_User# '
</CFQUERY>
<CFIF VerificationUser.RecordCount eq 1 AND Len(Form. Pass_User)
neq 0>
<CFSET Password
= Decrypt (VerificationUser. Pass_User,
VerificationUser.Key_User)
>
<CFIF Form.PassJJser eq Password>
<CFSET Session. login = "true">
<CFSET Session.
user. id = IVerificationUser .Key__User#>
<CFSET Session. user. name = #VerificationUser . FirstN_User# &
" "
& #VerificationUser.LastN_User#>
<CFSET Session.
user .email = IVerificationUser .EMail_User#>
<CFSET TotalLogins = #VerificationUser.TotalLogins_User# + 1>
<CFSET DateNow
= #DateFormat(Now(), "dd/mm/yyyy")#& " " &
#TimeFormat(Now(), "HH:mm:ss")#>
<!--- Обновление
записи (Update record) --->
<CFQUERY
NAME="UpdateUser" DATASOURCE="#Application.dsn#">
UPDATE UserMail SET LastIP_User = '#CGI.REMOTE_ADDR#',
LastBrowser_User = '#CGI.HTTP_USER_AGENT#',
LastLogin_User = '#DateNow#',
TotalLogins_User = #TotalLoginst
WHERE Key_User = ISession.user.id#
</CFQUERY>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=mailbox.cfm">
<CFEXIT>
<CFELSE>
<!--- Отказ
в авторизации (Authenticate failure) --->
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm?error=l">
</CFIPi>
<CFELSE>
<!--- Отказ
в авторизации (Authenticate failure) --->
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm?error=2">
</CFIF>
<CFELSE>
<CFIF isDefined("Error")>
<CFSET msgError="#Application.msgErrorLogin#">
</CFIF>
<DIV id="menu">
<TABLE width=440
border=0 cellpadding=0 cellspacing=0>
<TR valign="Middle">
<TD><SPAN
class="txtmenustat">
Log In I
<A href="signup.cfm" target="_top" class="txtmenu"
onMouseOver="javascript:layerWrite('prompt',null,
'<span
class=\'txtprompt\'>Sign up for reception of a Mail Box</span>');
window.status='Sign
up for reception of a Mail Box';
return true"
onMouseOut="javascript:layerWrite('prompt',null,'');
window.status=''; return true">Sign Up</A> Isnbsp;
<A href="help.cfm" target="_top" class="txtmenu"
onMouseOver="javascript:layerWrite
('prompt' , null, '<span
с1ass=\ ' txtprompt\
' >The auxiliary information<"/span> ' ) ;
window.status='The
auxiliary information';
return true"
onMouseOut="javascript:layerWrite('prompt',null,'');
window.status='';
return true">Help</A>
</SPANX/TD>
</TR>
</TABLE>
</DIV>
<DIV id="prompt"><SPAN
class="txtprompt"></SPAN></DIV>
<DIV id="basic">
<P class="title">Log In</P>
<FORM action="login.cfra"
METHOD="POST" name="forml">
<TABLE border="0" cellspacing="4" cellpadding="0">
<CFIF isDefined("msgError")>
<CFOUTPUT>
<TR><TD
colspan="2" align="center" class="txtError">
#msgError#</TD></TR>
</CFOUTPUT>
</CFIF>
<TRXTD width="100"
align="right" class="txtForml">
E-Mail (Login)</TD>
<TD class="note"><input name="EMail_User"
size="17"></TD>
</TR>
<TR><TD align="right" class="txtForml">
Password</TD><TD
class="note">
<input type="password"
name="Pass_User" size="17"></TD></TR>
<TR><TD align="right"xinput type="submit" value="Send"x/TD>
<TD><input
type="reset" value="Clear"></TD></TR>
<TR><TD colspan="2" align="left" class="txtForml">
Forgot your
password?<br><A href="javascript:SendPassword();"
onMouseOver="window.status='Have
it emailed to you';
return true"
onMouseOut="window.status='';
return true">
Have it emailed to you. </A></TD></TR>
</TABLE>
</FORM>
</DIV>
</CFIF>
</CFIF>
</BODY>
</HTML>
Листинг
П2.7. Код страницы signup.cfm
<HTML>
<HEAD>
<TITLE>Signup</TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>#Application.myBGColor#</cfoutput>">
<CFIF isDefined("Session.user.id") AND Session.login eq "true">
<!---
Пользователь уже существует
(The user is
already determined) --->
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=raailbox.cfm">
<CFELSE>
<CFIF isDef
ined ('"Form. EMailJJser") >
<CFSET DIsuccessful = 1>
<CFSET msgError = "Warning Error!">
<CFIF ,Len(Form.EMail_User) le 3>
<CFSET msgError
= msgError & "<br>" & #Application.msgErrorl#>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF Len(Form.PassJJser) le 4>
<CFSET msgError
= msgError & "<br>" & #Application.msgError2#>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF IsNumeric(Form.Pass_User)>
<CFSET msgError
= msgError & "<br>" & #Application.msgError3#3>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF Form.Pass_User not equal Form.Confirm>
<CFSET msgError
= msgError & "<br>" & #3Application.msgError4#>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF Lcn(Form.FirstN_User)
le 0>
<CFSF.T msgError
= msgError & "<br>" 5 #Application.msqError5#>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF Len(Form.LastN_User) le 0>
<CFSET msgError
- msgError & "<br>" & #Application.msgError6#>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF YesNoFormat(DIsuccessful) equal "No">
<!--- Ошибка
ввода (Error of input) --->
<CFSET email
= #Form.EMail_User#>
<CFSET firstn = #Form.FirstN_User#>
<CFSET lastn = #Form.LastN_User#>
<CFELSE>
<!--- Проверка
(Verification) --->
<CFSET EMail_User
= #Form.EMail_User# &
#Application.mailserver#>
<CFQUERY NAME="VerificationUser"
DATASOURCE="#Application.dsn#">
SELECT Key_User
FROM UserMail
WHERE EMail_User='#EMail_User#'
</CFQUERY>
<CFIF VerificationUser.RecordCount eq 1>
<!--- Запись
с этим адресом уже существует!
(The record with this EMail
address already
exists!) --->
<CFSET email
= "">
<CFSET firstn
= #Form.FirstN_User#>
<CFSET lastn
= #Form.LastN_User#>
<CFSET msgError = "The record
with this EMail
address
already exists!">
<CFELSE>
<!--- Добавление
записи (Add record) --->
<CFSET DateNow = #DateFormat(Now(),
"dd/mm/yyyy")#&
" " &
#TimeFormat(Now(),
"HH:mm:ss")#>
<CFQUERY NAME="AddUser"
DATASOURCE="#Application.dsn#">
INSERT INTO UserMail(EMailJJser,
FirstN_User,
LastNJJser,
DateSignUp_User, LastLogin_User,
LastIP_User, LastBrowser_User,
TotalLogins_User)
VALUES('#EMail_User#',
'tForm.FirstN_Userl',
'#Form.LastN_User#', '#DateNow#',
'#DateNow#',
'#CGI.REMOTE__ADDR#',
'#CGI.HTTP_USER_AGENT#',
1)
</CFQUERY>
<!--- Извлечение
ключа (Extraction of a key) --->
<CFQUERY
NAME="UserExtKey" DATASOURCE="#Application.dsn#">
SELECT Key_User
FROM UserMail
WHERE EMailJJser
= '§EMail_Userl'
</CFQUERY>
<CFOUTPUT
QUERY="UserExtKey">
<CFSET Session.login = "true">
<CFSET Session.user.id = #UserExtKey.Key_User#>
<CFSET Session.user.name = #Form.FirstN_User# & " " &
#Form.LastN_User#>
<CFSET Session.user.email
= IEMail_Userl>
</CFOUTPUT>
<CFSET Password
= Encrypt(Form.Pass_User, Session.user.id)>
<CFQUERY NAME="UpdatePass" DATASOURCE="#Application.dsn#">
UPDATE UserMail SET Pass_User = '#Password#'
WHERE Key_User
= #Session.user.id#
</CFQUERY>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=sendpassword.cfm?
EMail=<CFOUTPUT>ISession.user.email#
</CFOUTPUT>SType=SignUp">
<CFEXIT>
</CFIF>
</CFIF>
<CFELSE>
<CFSET email
= "">
<CFSET firstn = "">
<CFSET lastn = "">
</CFIF>
<DTV id="menu">
<TABLE width=440
bordcr-0 cellpadding=0 cellspacing=0>
<TR valign="middle">
<TD><SPAN
class="txtmenustat">
<a href-"loqin.cfm"
targyl=" Lup" с1аяя="Г.хШепи"
onMouseOver="javascript:layerWrite
( 'prompt ' , null , '<span
cla53=\'txtprompt\'>Datd input for work with a Mail Box</span>' ) ;
window. status='
Data input for work with a Mail Box';
return true"
onMouseOut="
javascript :layerWrite ( 'prompt' , null/ ' ' ) ;
window. status='
' ; return true">Log In</A> | snbsp;
Sign UpSnbsp; |
<A href="help.cfm" target="_top" class="txtmenu"
onMouseOver="
javascript : layerWrite ( 'prompt ' , null, ' <span
class=\ 'txtprompt\'>The auxiliary inf ormation</span> ' ) ;
window. status='
The auxiliary information';
return true"
onMouseOut="
javascript: layerWrite ( 'prompt ', null, ' ') ;
window. status= ' ' ; return true">Help</A>
</SPAN></TD>
</TR>
</TABLE>
</div>
<DIV id=
"prompt "><S PAN class="txtprompt"></SPAN></DIV>
<DIV id="basic">
<P class="title">Sign
Up</P>
<FORM action="signup.cfm"
method="post" name="forml">
<TABLE width="315"
border="0" cellspacing="4" cellpadding="0">
<CFIF isDefined("msgError") >
<CFOUTPUT>
<TR><TD
colspan="2" align="center" class="txtError">
#msgError#
</TD></TR>
</CFOUTPUT>
</CFIF>
<TR><TD align="right" class="txtForml">
E-Mail (Login)
</TD><TD width="215" class="txtForml">
<input name="EMail
User" size="10"
value="<CFOUTPUT>#email#</CFOUTPUT>"><CFOUTPUT>
#Application.mailservertt</CFOUTPUT> *</TD></TR>
<TR><TD align="right" class="txtForml">
Password</TD><TD class="txtForml">
<input type="password" name="Pass_User"
size="10">
*</TD></TR>
<TR><TD
align="right" class="txtForml">
Confirm</TD><TD class="txtForml">
<input type="password" name="Conf irm"
size="10">Snbsp;
*</TD></TR>
<TR><TD align="right" class="txtForml">
First Name</TD><TD class="txtForml">
<input name="FirstN_User" size="17"
value="<CFOUTPUT>#firstn#</CFOUTPUT>"> *
</TD></TR>
<TR><TD
align="right" class="txtForml">
Last Name</TD><TD class="txtForml">
<input name="LastN_User" size="17"
value="<CFOUTPUT>llastnf</CFOUTPUT>"> *
</TD></TR>
<TR><TD
align="right">
<input type="submit"
value=" Add "></TD><TD>
<input type="reset" value="Clear"></TD></TR>
</TABLE>
</FORM>
</div>
</CFIF>
</BODY>
</HTML>
Листинг
П2.8. Код страницы sendpassword.cfm
<CFIF isDefined("URL.EMail")>
<CFQUERY
NAME="Verification" DATASOURCE="#Application.dsnt">
SELECT Pass_User, FirstN_User, EMail_User
FROM UserMail
WHERE EMail_User
= '#URL.EMail#'
</CFQUERY>
<CFIF Verification.RecordCount
eq 1>
<CFSET PostMasterEMail
= "Root" & #Application.mailserver#>
<CFSET Password = Decrypt(Verification.Pass_User,
Verification.Key_User)>
<!--- Отправка
пароля (Send EMail Password) --->
<CFMAIL TO="#URL.EMail#"
FROM="#PostMasterEMail#"
SUBJECT="Password"
SERVER="#Application.smtp#">
Dear #Verification.FirstN_User#
This message
was sent at your request.
For work with
the project "#Application.ApplicationName#",
you are registered
E-Mail address(Login): #Verification.EMail_User#
with the password:
#Password#
Best wishes.
</CFMAIL>
</CFIF>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
</CFIF>
<HTML>
<BODY bgcolor="<CFOUTPUT>#Application.myBGColor#</CFOUTPUT>">
<CFIF isDefined("URL.Type")>
<META HTTP-EQUIV="Refresh"
CONTENT="0;ORL=mailbox.cfm">
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
</CFIF>
</BODY>
</HTML>
Листинг
П2.9. Код страницы edituser.cfm
<HTML>
<HEAD>
<TITLE>Edit
User</TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>#Application.myBGColor#</cfoutput>">
<CFIF isDefined("Session.user.name")>
<CFIF isDefined("Form.Pass_User")>
<CFSET DIsuccessful = l>
<CFSET msgError = "Warning Error!">
<CFIF Len(Form.Pass_User) le 4>
<CFSET msgError
= msgError & "<br>" & #Application.msgError2#>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF IsNumeric(Form.Pass_User)>
<CFSET msgError
= msgError & "<br>" & #Application.msgError3#>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF Form.Pass_User not equal Form.Confirm>
<CFSET msgError
= msgError & "<br>" & tApplication.msgError4#>
<CFSET DIsuccessful = 0>
</CFIF>
<CFIF YesNoFormat(DIsuccessful) equal "Yes">
<!--- Обновить
пароль (Update password) --->
<CFSET Password
= Encrypt(Form.PassJJser, Session.user.id)>
<CFQOERY NAME="UpdateUser" DATASOURCE="#Application.dsn#">
UPDATE UserMail
SET Pass_User
= '#Password#'
WHERE EMail_User='#Session.user. email#'
</CFQUERY>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=sendpassword.
cfm?EMail=<CFOUTPUT>#Session.user.email#
</CFOUTPUT>&Type=EditUser">
<CFEXIT>
</CFIF>
</CFIF>
<DIV id="menu">
<TABLE width=440
border=0 cellpadding=0 cellspacing=0>
<TR valign="Middle">
<TD><span
class="txtmenustat">
<A href="mailbox.cfm"
target=" top" class="txtmenu"
nnMouseOvor=javaeaript:laycrWritc('prompt',null,'<span
class=\,'rxtprompt\ '>Mail Box</span>' ) ;
window.status='Mail
Box';
return true"
onMouseOut="javascript:layerWrite('prompt',null,'');
window.status=''; return true">Mail Box</A> ISnbsp;
<A href="newmail.cfm" target="_top" class="txtmenu"
onMouseOver="javascript:layerWrite('prompt',null,'<span
class=\'txtprompt\'>New Mail</span>');
window.status='New
Mail'; return true"
onMouseOut="javascript:layerWrite('prompt',null,'');
window.status=''; return true">New Mail</A> |
<A href="addresses.cfm" target="_top" class="txtmenu"
onMouseOver="javascript:layerWrite('prompt',null,'<span
class=\'txtprompt\'>Addresses</span>');
window.status='Addresses';
return true"
onMouseOut="javascript:layerWrite('prompt',null,'');
window.status='';return true">Addresses</A> |
<A href="logout.cfm" target="_top" class="txtmenu"
onMouseOver="javascript:layerWrite('prompt',null,'<span
class=\'txtprompt\'>Log Out</span>'};
window.status='Log
Out'; return true"
onMouseOut="javascript:layerWrite('prompt1,null,'');
window.status=''; return true">Log Out</A>
</SPANX/TD>
</TR>
</TABLE>
</DIV>
<DIV id=
"prompt "><span class="txtprompt"X/spanx/DIV>
<DIV id="basic">
<p class="title"*>Edit
User
<CFOUTPUT>#Session.user.name#</CFOUTPUT></p>
<FORM action="edituser . cfm"
method="post"
name="forml">
<TABLE width="315" border="0"
cellspacing="4"
cellpadding="0">
<CFIF isDefined("msgError") >
<CFOUTPUT>
<TR><TD
colspan="2" align="center" class="txtError">
tmsgErrort
</TD></TR>
</CFOUTPUT>
</CFIF>
<TR><TD align="right" class="txtForml">
E-Mail (Login) </TD><TD width="215"
class="txtForml">
<CFOUTPUT>#Session.user.email#</CFOUTPUT></TD></TR>
<TR><TD align="right" class="txtForml">
Password</TD><TD class="txtForml">
<input type="password" name="Pass_User"
size="10">
*</TD></TR>
<TR><TD align="right" class="txtForml">
Confirm</TD><TD class="txtForml">
<input type="password" name="Confinn"
size="10">
*</TD></TR>
<TR><TD align="right">
<input type="submit"
value=" Set "></TD><TD>
<input type="reset" value="Reset"></TD></TR>
</TABLE>
</FORM>
</div>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
</CFIF>
</BODY>
</HTML>
Листинг
П2.10. Код страницы mailbox.cfm
<CFIF isDefined("Session.user.name")>
<CFQUERY NAME="User" DATASOURCE="#Application.dsn#">
SELECT EMail_User, Pass_User
FROM UserMail
WHERE Key User=#Session.user.idtt
</CFQUERY>
<CFLOOP QUERY="User">
<CFSET Login
= #Left(EMail_User, (FindOneOf("@", EMail_User)-1))#>
<CFSET Password
= Decrypt(Pass_User, Session.user.id)>
</CFLOOP>
<CFQUERY
NAME="CountNewMail" DATASOURCE="#Application.dsn#">
SELECT Key_Box
FROM MailBox
WHERE Key_User=#Session.user.id#
AND Key_TypeBox
= 1 AND ReadState_Box = 0
</CFQUERY>
<CFIF not
isDefined("URL.TypeBox")>
<CFINCLUDE
TEMPLATE="receiving_mail.cfm">
<CFELSE>
<CFIF URL.TypeBox eq 1>
<CFINCLUDE
TEMPLATE="receiving_mail.cfm">
<CFELSE>
<CFSET CountNewMail
= #CountNewMail.RecordCount#>
</CFIF>
</CFIF>
<HTML>
<HEAD>
<meta http-equiv="Expires"
content="Tue, 01 Jan 1980 1:00:00 GMT">
<meta http-equiv="Cache-Control" content="max-age=0">
<TITLE>Mail Box</TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>#Application.myBGColor#</cfoutput>">
<script type="text/javascript" language="JavaScript"
src="selectchecks.
js"></script>
<script>
function MoveDeleteSelMail(block,
type, what) {
idxlen = SelUnsellnv(block);
var strCheck = "";
for (i=0;i<idxlen;i++) {
if (ns) {
if (document.layers[block].
document.form2.elements[i].checked==
true) {
if (strCheck=="")
{
strCheck =
document . layers [block] .document.
form2. elements
[i] .value;
} else {
strCheck = strCheck
+ "," +
document . layers [block] .document .
form2. elements
[I] .value;
}
} else {
if (document . form2 .elements (i) .
checked==true)
(
if (strCheck=="") (
strCheck = document . form2 .
elements (i)
.value;
} else {
strCheck = strCheck
+ "," +
document. form2. elements (i) .value;
}
if (strCheck
== "") {
alert ("For moving or removal it is necessary
to select even
one mail!");
} else {
eval ("window.
location. href =
'movedel_mail . cfm?Type="+type+"&What="+what+"&KeySel="+strCheck+"
' '
</script>
<DIV id="menu">
<TABLE width=440
border=0 cellpadding=0 cellspacing=0>
<TR valign="Middle">
<TDXspan class="txtmenustat">
Mail Box |
<A href="newmail.cfm"
target="_top" class="txtmenu"
onMouseOver=" javascript: layerWrite ( 'prompt' , null,
'<span class=\'txtprompt\'>New
Mail</span>';
window. status=' New Mail'; return true"
onMouseOut="
javascript : layerWrite ( ' prompt ' , null ,'')/'
window. status=' '; return true">New Mail</A> |
<A href="addresses. cfm" target="_top" class="txtmenu"
onMouseOver=" javascript : layerWrite ( 'prompt ' , null,
'<span class=\
' txtprompt\ '>Addresses</span>' )
window. status=' Addresses '; return true"
onMouseOut=" javascript: layerWrite ( 'prompt ', null, ' ') ;
window. status=' ';return true">Addresses</A> |
<A href ="logout. cfm" target="_top"
class="txtmenu"
onMouseOver=" javascript: layerWrite ( 'prompt ' , null,
'<span class=\
'txtpromptX '>Log Out</span>' ) ;
window. status=' Log Out'; return true"
onMouseOut=" javascript: layerWrite ( 'prompt1 , null, ' ' )
;
window. status= ' ' ; return true">Log Out</A>
</span></TD>
</TR>
</TABLE>
</div>
<DIV id="prompt"xspan
class="txtprompt"></span></DIV>
<DIV id="basic">
<CFIF isDefined("URL.TypeBox")>
<CFSET TypeBox
= #URL.TypeBox#>
<CFELSE>
<CFSET TypeBox
= 1>
</CFIF>
<CFIF TypeBox eq 2 OR TypeBox eq 4>
<CFSET ToFrom
= "To">
<CFELSE>
<CFSET ToFrom
= "From">
</CFIF>
<CFQUERY
NAME="NameTypeBox" DATASOURCE="#Application.dsn#">
SELECT Name_TypeBox
FROM TypeBox
WHERE Key_TypeBox=#TypeBox#
</CFQUERY>
<p class="title">Mail
Box (
<CFOUTPUT QUERY="NameTypeBox">#Name_TypeBox#</CFOUTPUT>
<CFIF TypeBox
eq 1><CFOUTPUT>New - #CountNewMaill</CFOUTPUT>
</CFIF>
)
<A href="edituser.cfm"
class="txtlink">
<CFOUTPUT>ISession.user.namet</CFOUTPUT></A></p>
<CFIF isDefined("Order") AND isDefined("Trend")>
<CFSET Order
= #0rder# & ' ' & #Trend# >
<CFELSE>
<CFSET Order
= 'Date_Box DESC'>
</CFIF>
<CFIF not isDefined("Search")>
<CFSET Search
= ''>
</CFIF>
<CFQUERY NAME="ListNameTypeBox"
DATASOURCE="#Application.dsn#">
SELECT TypeBox.Key_TypeBox,
TypeBox.Name_TypeBox
FROM TypeBox
GROUP BY TypeBox.Key_TypeBox,
TypeBox.Name_TypeBox
ORDER BY TypeBox.Key_TypeBox
</CFQUERY>
<CFQUERY
NAME="CountTypeBox" DATASOURCE="#Application.dsn#">
SELECT TypeBox.KeyJTypeBox, Count(Mai1Вох.Кеу_ТуреВох)
AS Count_TypeBox
FROM TypeBox, MailBox
WHERE TypeBox.Key_TypeBox = MailBox.KeyJTypeBox
AND (((MailBox.Key_User)=#Session.user.id#))
GROUP BY TypeBox.Key_TypeBox
ORDER BY TypeBox.Key_TypeBox
</CFQUERY>
<!--- Создание
массива (Create Array) CountTypeBoxArray --->
<CFSET CountTypeBoxArray
= ArrayNew(2)>
<CFLOOP QUERY="ListNameTypeBox">
<CFSET CountTypeBoxArray[CurrentRow][1] =
Name_TypeBox[CurrentRow]>
<CFSET CountTypeBoxArray[CurrentRow][2]
= 0>
</CFLOOP>
<CFLOOP QUERY="CountTypeBox">
<CFSET CountTypeBoxArray[Key_TypeBox[CurrentRow]][2]
=
Count_TypeBox[CurrentRow]>
</CFLOOP>
<CFQUERY
NAME="ListMail" DATASOURCE="#Application.dsn#">
SELECT MailBox.Key_Box, MailBox.To_Box, MailBox.From_Box,
MailBox.Subject_Box, MailBox.Date_Box,
MailBox.ReadState_Box
FROM TypeBox INNER JOIN MailBox
ON TypeBox.Key_TypeBox = MailBox.Key_TypeBox
WHERE (((TypeBox.Key_TypeBox)=#TypeBox#)
AND ((MailBox.Key_User)=#Session.user.idi))
AND (#ToFrom#_Box Like '%#Search#%'
OR Subject_Box
Like '%#Searchtt%')
ORDER BY lOrderf;
</CFQUERY>
<FORM action="mailbox.cfm?TypeBox=<CFOUTPUT>#TypeBox#
</CFOUTPUT>"
method="post"
name="forml">
<input name="Search" size="20"
value="<CFOUTPUT>ISearch#</CFOUTPUT>">
<input type="submit" value="Search">
<CFIF TypeBox eq 3>
<input type="Button"
value="Empty Deleted"
onClick="javascript:location.href='emptydel.cfm'">
</CFIF>
</FORM>
<CFSET CurBlockPages
= 1>
<CFIF isDefined("URL.CurPage")>
<CFSET CurPage
= #URL.CurPage#>
<CFELSE>
<CFSET CurPage
= 1>
</CFIF>
<CFIF isDefined("URL.StartPg") AND isDefined("URL.EndPg")>
<CFSET StartPg
= #URL.StartPg#>
<CFSET EndPg
= #URL.EndPg#>
<CFELSE>
<CFSET StartPg
= 1>
<CFSET EndPg = Application.PageRows>
</CFIF>
<TABLE border="0"
cellpadding="0" cellspacing="0">
<TR><TD colspan="2" class="txt" align="right">
Showing:
<CFSET CountPages =
Ceiling(ListMail.recordCount/Application.PageRows)>
<CFLOOP INDEX = "Pages" FROM = "1" TO = "#CountPages#">
<CFOUTPUT>
<CFSET StartP
=
Pages*Application.PageRows-Application.PageRows+l>
<CFSET EndP = Pages*Application.PageRows>
<CFIF Pages eq CountPages>
<CFSET EndP = ListMail.recordCount>
</CFIF>
<CFIF Pages eq CurPage>
#StartP#-#EndP#
<CFELSE>
<A href="mailbox.cfm?CurPage
=#Pages#&StartPg=#StartP#&EndPg
=#EndP#&Search=#Search#&TypeBox=#TypeBox#"
class="txtlink">#StartP#-#EndP#</A>
</CFIF>
<CFIF Pages
neq CountPages>,</CFIF>
<CFIF Pages
eq Application.MaxLinePages*CurBlockPages>
<CFSET CurBlockPages = CurBlockPages + 1>
<br>
</CFIF>
</CFOUTPUT>
</CFLOOP>
</TDX/TR>
<TR><TD
valign="top">
<TABLE border="0"
cellpadding="2" cellspacing="4">
<TR><TD bgcolor="#cbccbd" height=l></TD></TR>
<TR><TD class="txt">Folder</TD></TR>
<TR><TD bgcolor="icbccbd" height=l></TD></TR>
<CFLOOP INDEX
= "i" FROM - "1"
TO - #ArrayLen(CountTypeBoxArray)
#>
<CFIF i eq TypeBox>
<TR><TD class="Lxtact">
<CFOUTPUT>#CountTypeBoxArray[i)
[2]#</CFOUTPUT>
-
<CFOUTPUT>#CountTypeBoxArray[i]
[1] #</CFOUTPUTX/TDX/TR>
<CFELSE>
<TR><TD class="txtlink">
<CFOUTPUT>#CountTypeBoxArray
[i][2]#</CFOUTPUT>
-
<A href="mailbox.cfm?TypeBo
x=<CFOUTPUT>#i#</CFOUTPUT>"
class="txtlink"><CFOUTPUT>
#CountTypeBoxArray[i][1]#</CFOUTPUT></A>
</TD></TR>
</CFIF>
</CFLOOP>
</TABLE>
</TD>
<TD valign="top">
<TABLE border="0"
cellpadding="2" cellspacing="4">
<TR><TD colspan="5" bgcolor="#cbccbd" -
height=lX/TDX/TR>
<TR><TD class="txt">Check</TD>
<TD class="txt"><CFOUTPUT>#ToFrom#</CFOUTPUT>
<A href="mailbox.cfm?0rder=
<CFOUTPUT>#ToFrom#</CFOUTPUT>_Box&Trend=ASC&TypeBox=
<CFOUTPUT>#TypeBox#</CFOOTPUT>">
<img src="asc.gif"
alt="0rder by ASC" border='0'x/A>
<A href="mailbox.cfm?0rder=
<CFOUTPUT>#ToFrom#</CFOUTPUT>_Box&Trend=DESC&TypeBox=
<CFOUTPUT>|TypeBoxf</CFOUTPUT>">
<img src="desc.gif" alt="0rder by DESC"
border='0'x/A> Snbsp;
</TD>
<TD class="txt">Subject<A
href="mailbox.cfm?0rder=
Subj ect_Box&Trend
=ASC&TypeBox=<CFOUTPUT>#TypeBox#</CFOUTPUT>">
<img src="asc.gif" alt="0rder by ASC"
border='0'></A>
<A href="mailbox.cfm?Order=Subject_BoxSTrend
=DESCSTypeBox=<CFOUTPUT>#TypeBox#</CFOUTPUT>">
<img src="desc.gif" alt="0rder by DESC"
border='0'></A>
</TD>
<TD class="txt">Date<A
href="mailbox.cfm?0rder=
Date_Box&Trend=ASC&TypeBox=
<CFOUTPUT>|TypeBoxl</CFOUTPUT>">
<img src="asc.gif" alt="0rder by ASC"
border='0'x/A>
<A href="mailbox.cfm?Order=Date_Box&Trend
=DESC&TypeBox=<CFOUTPUT>#TypeBox#</CFOUTPUT>">
<img src="desc.gif" alt="0rder by DESC"
border='0'></A> Snbsp;
</TD>
<TD olass="txt"
align="center">Controls</TD>
</TR>
<TR><TD colspan="5" bgcolor="#cbccbd"
height=l></TD></TR>
<CFIF TypeBox eq 2 OR TypeBox eq 3 OR TypeBox eq 4>
<CFSET statusDel
= "DeleteAbsolut">
<CFELSE>
<CFSET statusDel
= "Delete">
</CFIF>
<FORM method="post"
name="form2">
<CFIF ListMail.recordCount eq 0>
<TRXTD class="txt"
colspan="5" align="center">
The data are
absent</TD></TR>
<CFELSE>
<CFLOOP QUERY="ListMail" STARTROW="#StartPg#"
ENDROW="#EndPg#">
<TRXTD class="txt"
align="center">
<input type="checkbox"
value="<CFOUTPUT>#Key_Boxf</CFOUTPUT>"
name="<CFOUTPUT>#Key_Box#</CFOUTPUT>"x/TD>
<CFIF ToFrom eq "To">
<TD class="<CFIF
To_Box does not contain Search
OR Search eq ''>txt
<CFELSE>txtsearch</CFIF>">
<CFOUTPUT>#To_Box#</CFOUTPUT></TD>
<CFELSE>
<TD class="<CFIF
From_Box does not contain Search
OR Search eq ''>txt<CFELSE>txtsearch
</CFIF>"><CFOUTPUT><CFIF
Read-
State_Box eq Oxbx/CFIF>#From_Box#<CFIF
ReadState_Box
eq
0></b></CFIF></CFOUTPUT></TD>
</CFIF>
<TD class="<CFIF
Subject_Box does not contain
Search OR Search eq ''>txt<CFELSE>
txtsearch</CFIF>"><A
href="view_mail.cfm?Key=<CFOUTPUT>#Key_Box#
</CFOUTPUT>&TypeBox=<CFOUTPUT>
#TypeBox#</CFOUTPUT>" class="txtlink">
<CFOUTPUT><CFIF
ReadState_Box eq
0><bX/CFIF>#Subject_Box#<CFIF
ReadState__Box
eq
0></b></CFIF></CFOUTPUT></A></TD>
<TD class="<CFIF
Date_Box does not contain Search
OR Search eq ' '>txt<CFELSE>txtsearch</CFIF>">
<CFOUTPUT><GFIF
Read-
State_Box eq Oxb></CFIF>#Date_Box#<CFIF ReadState_Box eq
O></b></CFIF></CFOUTPUT></TD>
<TD class="txt"
align="center">
<CFIF TypeBox
eq 1 OR TypeBox eq 3 OR TypeBox eq 5>
<A
href="newmail.cfm?To=<CFOUTPUT>#From_Box#
</CFOUTPOT>&Key=<CFOUTPUT>
#Key_Box#</CFOUTPUT>">
<img src="reply.gif"
alt="Reply"
border='0'></A>
</CFIF>
<CFIF TypeBox
eq 4>
<A href="newmail.cfm?To=<CFOUTPUT>#To_Box#</CFOUTPUT>
&Draft=yes&Key=<CFOUTPUT>#Key_Box#</CFOUTPUT>">
<img src="edit.gif" alt="Edit"
border='0'></A>
</CFIF>
<A href="view_mail.cfm?Key=
<CFOUTPUT>#Key_Box#</CFOUTPUT>
&TypeBox=<CFOUTPUT>#TypeBox#</CFOUTPUT>">
<img src="view.gif" alt="View"
border=' 0'
x/A>
<A href="movedel_mail.cfm?Type=
<CFOUTPUT>#statusDel#</CFOUTPUT>
&Key=<CFOUTPUT>#Key_Box#</CFOUTPUT>">
<img src="delete.gif" alt="Delete"
border=' 0 '></A>
<CFIF TypeBox eq 1>
<A href="movedel_mail.cfm?
Type=Move&What=5&Key=<CFOUTPUT>
#Key_Box#</CFOUTPUT>">
<img src="junk.gif" alt="Move junk"
border='0'></A>
</CFIF>
<CFIF TypeBox
eq 3 OR TypeBox eq 5>
<A href="movedel_mail.cfm?
Type=Move&What=l&Key=<CFOUTPUT>
iKey_Box#</CFOUTPUT>">
<img src="undo.gif" alt="Undo"
border='0'></A>
</CFIF>
</TD></TR>
</CFLOOP>
</CFIF>
<TR><TD colspan="5" bgcolor="#cbccbd"
height=l></TD></TR>
<TR><TD colspan="4">
<A href="javascript:SelectAll('basic');"
class="txtlink">Select
All
. </A> ,
<A href="javascript:UnselectAll('basic');"
class="txtlink">Unselect
All
</A> ,
<A href="javascript:InvertChecks('basic');"
class="txtlink">
Invert Checks</A>
</TD>
<TD align="right">
<A href="javascript:MoveDeleteSelMail('basic',
'<CFOUTPUT>#statusDel#</CFOUTPUT>');">
<img src="deletesel.gif" border='0'
alt="Delete
Selected"x/A>
<CFIF TypeBox eq 1>
<A href="javascript:MoveDeleteSelMail('basic',
'Move', '5');">
<img src="junksel.gif" border='0'
alt="Move
junk Selected"x/A>
</CFIF>
<CFIF TypeBox
eq 3 OR TypeBox eq 5>
<A href="javascript:MoveDeleteSelMail('basic'
'Move', '1');">
<img src="undosel.gif" border='0'
alt="Undo
Selected"></A>
</CFIF>
</TDX/TR>
</TABLE>
</TDX/TR>
</TABLE>
</FORM>
</DIV>
</BODY>
</HTML>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
</CFIF>
Листинг
П2.11. Код страницы receiving_mail.cfm
<CFIF isDefined("Session.user.name")>
<CFPOP SERVER= #Application.pop#
USERNAME=#Login# PASSWORD=#Password#
ATTACHMENTPATH="c:\temp"
ACTION="GetAll" NAME="GetMail">
<CFOUTPUT
Q0ERY="GetMail">
<CFSET Date_ = #DateFormat(ParseDateTime(Date) ,
"dd/mm/yyyy")#&
" " &
#TimeFormat(ParseDateTime(Date), "HH:mm:ss")#>
<CFQUERY NAME="SaveMail"
DATASOURCE="#Application.dsn#">
<CFIF FindNoCase('Content-type:
text/html',
Header) gt 0>
<CFSET conType
= "HTML">
<CFELSE>
<CFSET conType
= "">
</CFIF>
INSERT INTO MailBox(KeyJJser,
Key_TypeBox,
To_Box, From_Box,
Cc_Box, Subject_Box, Body_Box,
ReplyTo_Box,
Type Box, Date Box, ReadState Box, Header_Box,
Attachments_Box,
AttachmentFiles_Box)
VALUES(#Session.user.id#, 1, '#To#' , #From#',
'#Cc#, '#Subject#',
'#Body#', '#Replyto#',
'#conType#', '#Date_#, 0, '#Header#',
'#Attachments#', '#Attachmentfiles#')
</CFQUERY>
<CFPOP SERVER= #Application.pop#
USERNAME=#Login#
PASSWORD=#Password# MESSAGENUMBER=1
ACTION="Delete" NAME="DelMail">
</CFOUTPUT>
<CFSET CountNewMail
=#CountNewMail.RecordCountt +
#GetMail.RecordCount#>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
</CFIF>
Листинг
П2.12. Код страницы movedel_mail.cfm
<CFIF isDefined("Session.user.name")>
<HTML>
<HEAD>
<TITLE>Move
Delete MaiK/TITLE>
</HEAD>
<BODY bgcolor="<CFOUTPUT>#Application.myBGColor#</CFOUTPUT>">
<CFIF isDefined("URL.Type")>
<CFIF URL.Type
eq "DeleteAbsolut">
<CFIF isDefined("URL.Key")>
<CFQUERY
NAME="DeleteMail" DATASOURCE="#Application.dsn#">
DELETE * FROM
MailBox WHERE Key_Box = #URL.Key#
</CFQUERY>
<CFELSE>
<CFIF isDefined("URL.KeySel")>
<CFQUERY
NAME="DeleteMail" DATASOURCE="#Application.dsn#">
DELETE * FROM
MailBox WHERE Key_Box IN (#URL.KeySel#)
</CFQUERY>
</CFIF>
</CFIF>
</HEAD>
<BODY bgcolor="<cfoutput>#Application.myBGColor#</cfoutput>">
<CFQUERY NAME="EmptyDeleteMail" DATASOURCE="#Application.dsn#">
DELETE * FROM MailBox
WHERE Key_User=
#Session.user.idtt AND Key_TypeBox = 3
</CFQUERY>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=mailbox.cfm">
</BODY>
</HTML>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
</CFIF>
Листинг
П2.14. Код страницы view_mail.cfm
<CFIF isDefined("Session.user.name")>
<CFIF isDefined("URL.Key")>
<CFQUERY
NAME="ViewMail" DATASOURCE="#Application.dsn#">
SELECT *
FROM MailBox
WHERE Key_Box
= #URL.Keyl
</CFQUERY>
<HTML>
<HEAD>
<TITLE>View
MaiK/TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>
#Application.myBGColor#</cfoutput>">
<script>
function Properties() {
eval("Variable=window.open
('properties_mail.cfm?Key=<CFOUTPUT>#URL.Keyt
</CFOUTPUT>', 'winviewmailprop',
'top=100, left=200,
width=250,
height=320')");
}
</script>
<DIV id="menu">
<TABLE width=440
border=0 cellpadding=0 cellspacing=0>
<TR valign="Middle">
<TDXspan
class="txtmenustat">
Mail Box
|
<A hifc;f="newnmail.cfm"
Largt;L="_Lop"
onMouseOver="javascript:layerWrite
( 'prompt1
, null, '<span
cla33=\'txtprompt\'>New Mail</span>' ) ;
window. status='
New Mail'; return
true" onMouseOut=" javascript : layerWrite
( 'prompt' ,null,
' ' ) ;
window. status=' '; return true">New Mail</A> | Snbsp;
<A href="addresses.cfm"
target="_top" class="txtmenu"
onMou5eOver="
javascript : layerWrite ( 'prompt' , null, '<span
class=\'txtprompt\'>Addresses</span>' )
; window. status='
Addresses '; return
true" onMouseOut=" javascript : layerWrite
( 'prompt ',
null, ' ') ;
window. status=' '; return true">Addresses</A> | Snbsp;
<A href="logout
.cfm" target="_top" class="txtmenu"
onMouseOver="
javascript: layerWrite ( 'prompt' , null, '<span
class=\ ' txtpromptX '>Log Out</span>' ) ; window. status=' Log Out';
return
true" onMouseOut=" javascript: layerWrite ( 'prompt ', null, ' ')
;
window. status=' '; return true">Log Out</A>
</span></TD>
</TR>
</TABLE>
<DIV id=
"prompt "><span class="txtprbmpt"></span></DIV>
<DIV id="basic">
<CFQUERY
NAME="TypeBox" DATASOURCE="#Application.dsn#">
SELECT TypeBox . Name_TypeBox
FROM TypeBox
WHERE Key_TypeBox
= #URL . TypeBoxt
</CFQUERY>
<CFQUERY
NAME="LMail" DATASOURCE="#Application. dsn#">
SELECT Key_Box
FROM MailBox
WHERE Key_TypeBox = #URL . TypeBoxf
AND Key_User=#Session.user.id#
</CFQUERY>
<CFSET ListMail = ValueList (LMail.Key_Box) >
<p class="title">
<A href="mailbox.cfm?TypeBox=<CFOUTPUT>
#URL.TypeBox#</CFOUTPUT>">
<CFOUTPUT>#TypeBox.Name TypeBox#</CFOUTPUT
/A> ( View
Mail )
<A href="edituser.cfm"
class="txtlink">
<CFOUTPUT>#Session . user . name#</CFOUTPUT></A>
</p>
<TABLE width="550" border="0" cellspacing="4"
cellpadding="0">
<TR><TD align="right" class="txt" colspan="2">
<CFOUTPUT>
<CFIF ListFind(ListMail,
URL. Key) gt 1>
<A href="view_mail.cfm?Key=#ListFirst (ListMail) #
&TypeBox=#URL.TypeBox#">
<img src="first
.gif " alt="First" border=' 0 '></A>
<A href="view_mail.cfm?Key=
#ListGetAt (ListMail,
ListFind (ListMail, URL. Key) -1)
# &TypeBox=#URL . TypeBox# " >
<img src="preview.gif " alt="Preview"
bprder= ' 0
' ></A>
</CFIF>
#bistFind (ListMail, URL. Key) # of
#ListLen (ListMail)
#
<CFIF ListFind (ListMail, URL. Key)
It ListLen (ListMail)
>
<A href="view_mail
. cfm?Key=ttListGetAt (ListMail, ListFind (ListMail,
URL . Key ) +1 ) # &TypeBox=#URL . TypeBox# " >
<img src="next.gif"
alt="Next" border='0'></A>
<A href ="view_mail.cfm?Key=|ListLast
(ListMail )#&TypeBox=#URL.TypeBoxt">
<img src="last
.gif " alt="Last" border='0 '></A>
</CFIF>
</CFOUTPUT>
</TD><TD class="txt">
<TR><TD
align="right" class="txtForml">From: </TD>
<TD class="txt" width="450">
<CFOUTPUT>#ViewMail
. From_Box#</CFOUTPUT></TD></TR>
<TR><TD align="right" class="txtForml">To: </TD>
<TD class="txt" width="450">
<CFOUTPUT>#ViewMail
. To_Box#</CFOUTPUTX/TDX/TR>
<TR><TD align="right" class="txtForml">Date
: </TD>
<TD class="txt">
<CFOUTPUT>#ViewMail
. Date_Box#</CFOUTPUTX/TDX/TR>
<TR><TD align="right" class="txtForml">Subject
: </TD> '
<TD class="txt">
<CFOUTPUT>#ViewMail.
Subject_Box#</CFOUTPUT></TD></TR>
<TRXTD align="right" class="txtForml">Cc: </TD>
<TD class="txt">
<CFOUTPUT>#ViewMail.
Cc_Boxt</CFOUTPUT></TD></TR>
<TRXTD align="right" class="txtForml">Bcc: </TD>
<TD class="txt">
<CFOUTPUT>#ViewMail. Bcc_Box#
</CFOUTPUT></TD></TR>
<TR><TD colspan="2" bgcolor="#cbccbd"
height=l></TD></TR>
<TR><TD class="txt" colspan="2">
<CFOUTPUT>
<CFIF ViewMail.Type_Box neq "HTML">
<xmp class="txt"></CFIF>
#ViewMail.Body_Box#
<CFIF ViewMail.Type_Box
neq "HTML"></xmp></CFIF>
</CFOUTPUT></TD></TR>
<TR><TD colspan="2" bgcolor="#cbccbd"
height=l></TD></TR>
<TR><TD align="right" class="txt"
colspan="2">
<CFIF ViewMail.Key_TypeBox eq 4>
<A href="newmail.cfm?To=<CFOUTPUT>
#ViewMail.To_Box#</CFOUTPUT>&Draft=yes&Key
=<CFOUTPUT>#ViewMail.Key_Box#</CFOUTPUT>">
<img src="edit.gif" alt="Edit" border='0'>
</A> snbsp;
</CFIF>
<CFIF ViewMail.Key_TypeBox
eq 2 OR ViewMail.Key_TypeBox eq 3
OR ViewMail.Key_TypeBox
eq 4>
<CFSET statusDel
= "DeleteAbsolut">
<CFELSE>
<GFSET statusDel
= "Delete">
</CFIF>
<CFIF ViewMail.Key_TypeBox
eq 1 OR ViewMail.Key_TypeBox eq 3
OR ViewMail.Key_TypeBox
eq 5>
<A href="newmail.cfm?To=<CFOUTPUT>
#ViewMail.From_Boxl</CFOUTPUT>&Key=
<CFOUTPUT>#ViewMail.Key_Box#</CFOUTPUT>">
<img src="reply.gif" alt="Reply" border='0'
/A> Snbsp;
</CFIF>
<A href="movedel_mail.cfm?Type=<CFOUTPUT>
#statusDel#</CFOUTPUT>&Key=
<CFOUTPUT>#ViewMail.Key_Box#</CFOUTPUT>">
<img src="delete.gif"
alt="Delete" border='0'></A>
<CFIF ViewMail.
Key_TypeBox eq 1>
<A href
="movedel_mail . cfm?Type=Move&What=5&Key=<CFOUTPUT>#ViewMail
. Key_Box#
</CFOUTPUT>">
<img src="junk.gif"
alt="Move junk" border='0'x/A>
</CFIF>
<CFIF ViewMail.Key_TypeBox eq 3 OR ViewMail .Key_TypeBox eq 5>
<A href="movedel_mail
. cfm?Type=Move&What=lSKey=<CFOUTPOT>#ViewMail . Key_Box#
</CFOUTPUT>">
<img src="undo.gif
" border=' 0 'x/A>
</CFIF>
</TD></TR>
<TR><TD
align="right" class="txtForml" valign="top">Attachments
:
</TD>
<TD>
<CFLOOP INDEX="i" LIST=#ViewMail . AttachmentFiles_Box#
DELIMITERS=iChr
( 9 } #>
<CFOUTPUT>
<A href="file
://#!#" class="txtlink">#i#</A><br>
</CFOUTPUT>
</CFLOOP>
</TD></TR>
<TRXTD align="right"
class="txt" colspan="2">
<FORM name="forml">
<input type="Button"
value="Properties"
onClick="
javascript: Properties () ; ">
</FORM>
</TD></TR>
</TABLE>
</div>
<CFIF ViewMail.
ReadState_Box eq 0>
<CFQUERY
NAME="SetReadStateMail" DATASOURCE="#Application. dsn#">
UPDATE MailBox
SET ReadState_Box
= 1
WHERE Key_Box = #URL.Keyl
</CFQUERY>
</CFIF>
</BODY>
</HTML>
</CFIF>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
</CFIF>
Листинг
П2.15. Код страницы properties_mail.cfm
<CFIF isDefined("Session.user.name")>
<CFIF isDefined("URL.Key")>
<CFQUERY NAME="PropertiesMail"
DATASOURCE="#Application.dsn#">
SELECT ReplyTo_Box, Header_Box
FROM MailBox
WHERE Key_Box
= #URL.Keyl
</CFQUERY>
<HTML>
<HEAD>
<TITLE>Properties
MaiK/TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>#Application
.myBGColor#</cfoutput>">
<TABLE width="100%" border="0"
cellspacing="4"
cellpadding="0">
<TD><TR class="txt">
<CFOUTPUT>#PropertiesMail. Header_Box#
</CFOUTPUT></TD></TR>
<TRXTD class="txt">
<CFOUTPUT>#PropertiesMail. ReplyTo_Box#
</CFOUTPUT></TD></TR>
</TABLE>
</BODY>
</HTML>
</CFIF>
<CFELSE>
<script>
window.close();
</script>
</CFIF>
Листинг
П2.16. Код страницы newmail.cfm
<CFIF isDefined("Session.user.name")>
<CFIF isDefined("URL.SendType")>
<CFIF Form.SaveDraft eq "No" AND
Form.UpdateDraft
eq "No">
<CFMAIL TO="#Form.To#"
FROM="#Form.From#"
CC="#Form.Cc#"
BCC="|Form.Bcc#"
SUBJECT="ttForm.Subject#"
SERVER="IApplication.smtp#"
TYPE="#Form.Type#"
MIMEATTACH="#Form.Attl#">
#Form.Body#
<CFIF Form.Att2
neq "">
<CFMAILPARAM FILE="|Form.Att2#">
<CFSET Att2 = #CHR(9)# & #Form.Att2#>
<CFELSE>
<CFSET Att2
= "">
</CFIF>
<CFIF Form.Att3
neq "">
<CFMAILPARAM FILE="#Form.Att3#">
<CFSET Att3 = #CHR(9)# & tForm.Att3#>
<CFELSE>
<CFSET Att3
= "">
</CFIF>
</CFMAIL>
<CFSET TypeBox
= 2><!— Исходящие (Outbox) —>
<CFELSE>
<CFSET TypeBox
= 4><!— Черновики (Draft) —>
</CFIF>
<CFSET AttachmentFiles
= Form.Attl & Att2 & Att3>
<CFSET DateNow = tDateFormat(Now(),
"dd/mm/yyyy")#&
" " &
#TimeFormat(Now(), "HH:mm:ss")#>
<CFIF Form.UpdateDraft
eq "Yes">
<CFQUERY
NAME="SaveMail" DATASOURCE="#Application.dsn#">
UPDATE MailBox
SET To_Box =
'#Form.To#',
Cc_Box = '#Form.Cc#',
Bcc_Box = '#Form.Bcc#',
Subject_BoM = '#Form.Subject#'
Dody_Box = '#Form.Body#',
Type_Box = ' #Form. Type# ',
Date__Box = '#DateNow#',
AttachmentFiles_Box
= '#AttachmentFiles#'
WHERE Key_Box = #Form.KeyBox#
</CFQUERY>
<CFELSE>
<CFQUERY NAME="SaveMail" DATASOURCE="#Application.dsn#">
INSERT INTO
MailBox(Key_User, Key_TypeBox, To_Box, From_Box,
Cc_Box, Bcc_Box, Subject_Box, Body_Box,
Type_Box, Date_Box, ReadState_Box,
AttachmentFiles_Box)
VALUES(#Session.user.id#,
#TypeBox#, '#Form.To#', 'iForm.Fromtt',
'#Form.Cc#', '#Form.Bcc#', '#Form.Subject*', '#Form.Body*',
'#Form.Type#', '#DateNow#', 1,
'#AttachmentFiles#')
</CFQUERY>
</CFIF>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=mailbo*.cfm">
<CFEXIT>
</CFIF>
<HTML>
<HEAD>
<TITLE>New
Mail</TITLE>
</HEAD>
<BODY onload="init();"bgcolor="<cfoutput>
#Application.myBGColor#</cfoutput>">
<script type="text/javascript"
language="JavaScript"
src="selectchecks.
js"></script>
<script>
function init()
(
}
function Displacement(top,
left) (
if(ns) {
document . layers
[' seladdr' ]. top = top;
document . layers [ 'basic' ]. left = left;
} else {
document .all
[ 'seladdr ']. style. top = top;
document. all [ 'basic' ] .style. left = left;
}
function SelAddr
(field, block) {
if(ns) document . layers [block] .document .
form3 . field.
value = field;
else document . form3. field. value = field;
Displacement (70, -777);
}
function Cancel
( ) (
Displacement (-400, 10);
}
function Done,(block_,
block) {
idxlen = SelUnsellnv (block) ;
var strToCcBcc = "";
for (i=0;i<idxlen;i++) {
if (ns) {
if (document. layers [block] .document .
fonn2 .elements
[i] .checked==
true) {
if (strToCcBcc=="")
{
StrToCcBcc =
docu-
ment, layers [block] .document . form2 .
elements [i]
.value;
} else {
StrToCcBcc =
strToCcBcc + "; " +
document. layers [block] .document. form2
.elements [i]
.value;
}
}
} else {
if (document.
form2. elements (i) .checked==true) {
if (strToCcBcc=="") (
strToCcBcc =
document. form2 .elements (i) .value;
} else {
strToCcBcc = StrToCcBcc + "; " +
document. form2
.elements (i) .value;
if (strToCcBcc
== "") {
alert ("For application it is
necessary to
select even one address!");
} else {
if(ns) field = document. layers [block]
.document. form3.
field. value;
else field = document . form3 . field. value ;
if (ns) eval ("document. layers [block_]
.document. forml
. "+field+" .value
'" + StrToCcBcc +"'");
else eval ("document. forml. "+field+".
value = '"
+ StrToCcBcc +"'");
Displacement (-400, 10);
}
function DoneCur
(block_, block, EMail) {
if(ns) field = document . layers [block] .
document . form3
. field. value;
else field = document. form3. field. value;
if (ns) eval ("document. layers [block_]
.document . forml
. "+field+". value
111
+ EMail +'"") ;
else eval ("document. forml. "+field+".
value = '"
+ EMail +"'");
Displacement (-400, 10);
}
function IsForml(fr)
{
if ( f r . To
. value . length==0 ) {
alert ("Please, enter field - 'To'");
return false;
}
function IsForm3(fr,
block_) {
if(ns) Root = "document . layers [block_]
.document .
forml"
else Root = "document . forml "
eval ("fr. Subject. value =
"+Root+"
. Subject .value") ;
eval ("fr. To. value = "+Root+" .To. value") ;
eval ("fr. Cc. value = "+Root+" .Cc. value") ;
eval ("fr. Вcс. value = "+Root+" .Вес. value") ;
eval ("fr. Body. value = "+Root+" .Body. value") ;
eval ("fr. Type. value = "+Root+" .Type. value") ;
return true;
}
function TypeClick(val,
block_) {
if(ns) document.layers[block_].
document.forml.Type.value
= val;
else document.forml.Type.value = val;
}
function SDraft(block_) {
if(ns) document.layers[block_].
document.forml.SaveDraft.value
=
"Yes";
else document.forml.SaveDraft.value
= "Yes";
}
function UDraft(block_) {
if(ns) document.layers[block_].
document.forml.UpdateDraft.value
"Yes";
else document.forml.UpdateDraft.value
= "Yes";
}
</script>
<CFIF isDefined("Form.Search")
OR isDefined("URL.CurPage")>
<CFOUTPUT>
<script>
function init()
{Displacement(70, -777);}
</script>
</CFOUTPUT>
</CFIF>
<DIV id="menu">
<TABLE width=440
border=0 cellpadding=0 cellspacing=0>
<TR valign="Middle">
<TD><span class="txtmenustat">
<A href="mailbox.cfm" target="_top" class="txtmenu"
onMouseOver="javascript:layerWrite('prompt',null,'<span
class=\'txtprompt\'>Mail Box</span>');
window.status='Mail
Box'; return true"
onMouseOut="javascript:layerWrite('prompt',null,'');
window.status='';
return true">Mail Box</A> | Snbsp;
New Mail ISnbsp;
<A href="addresses.cfm"
target="_top" class="txtmenu"
onMouseOver="javascript:layerWrite('prompt',
null,'<span
Class=\ 'txtprompt\
' >Addresses</span> ' ) ;
window.status='Addresses';
return true"
oriMouseOut="javascript:layerWrite('prompt',null,'');
window.status=''; return true">Addresses</A>&nb3p;|
<A hief="loguuL.<jfm" target="_top" class="txtme>nu"
onMouseOver="javascript:layerWrite('prompt',null,'<span
class=\'txtprompt\'>Log Out</span>'(;
window.status='Log
Out'; return true"
onMouseOut="javascript:layerWrite('prompt',null,'');
window.status=''; return true">Log Out</A>
</spanx/TD>
</TR>
</TABLE>
</DIV>
<DIV id="prompt"><span
class="txtprompt"x/spanx/DIV>
<CFIF isDefined("To")>
<CFSET to
= #To#>
<CFELSE>
<CFSET to
= "">
</CFIF>
<CFSET keybox
= 0>
<CFIF isDefined("Form.Subject")>
<CFSET subject
= #Form.Subject#>
<CFSET field = #Form.field#>
<CFSET cc = #Form.Cc#>
<CFSET bcc = #Form.Bcc#>
<CFSET body = #Form.Body#>
<CFIF #Form.Type# eq "">
<CFSET typel
= "checked">
<CFSET type2
= "">
<CFSET typeVal
= "">
<CFELSE>
<CFSET typel
= "">
<CFSET type2
= "checked">
<CFSET typeVal
= "HTML">
</CFIF>
<CFELSE>
<CFIF isDefined("URL.Key")>
<CFQUERY
NAME="EditMail" DATASOURCE="#Application.dsn#">
SELECT *
FROM MailBox
WHERE Key_Box
= iURL.Keytt
</CFQUERY>
<CFSET keybox
= #URL.Key#>
<CFIF isDefined("URL.Draft")>
<CFSET subject
= #EditMail.Subject_Box#>
<CFELSE>
<CFSET subject
= "Re: " & fEditMail.Subject_Box#>
</CFIF>
<CFSET field
= "To">
<CFSET cc = #EditMail.Cc_B.oxtt>
<CFSET bcc = #EditMail.Bcc_Boxl>
<CFSET body = #LTrim(EditMail.Body_Box)#>
<CFIF #EditMail.Type_Box# eq "">
<CFSET typel = "checked">
<CFSET type2 = " ">
<CFSET typeVal = " ">
<CFELSE>
<CFSET typel
= " ">
<CFSET type2 = "checked">
<CFSET typeVal = "HTML">
</CFIF>
<CFELSE>
<CFSET subject
= "">
<CFSET field = "To">
<CFSET cc = "">
<CFSET bcc = "">
<CFSET body = "">
<CFSET typel = "checked">
<CFSET type2 = "">
<CFSET typeVal = "">
</CFIF>
</CFIF>
<DIV id="basic">
<p class="title">New Mail
<A href="edituaer.cfm" class="txtlink'">
<CFOUTPUT>#Session.user.name#</CFOUTPUT></A></p>
<FORM action="riewmail.cfm?SendType=SendMail"
method="post"
name="forml" onSubmit="return IsForml(this);">
<TABLE width="400" border="0" cellspacing="4"
cellpadding="0">
<CFIF isDefined("msgError")>
<CFOUTPUT>
<TRXTD colspan="2" align="center" class="txtError">
#msgError#
</TD></TR>
</CFOUTPUT>
</CFIF>
<TR>
<TD align="right"
class="txtForml">From</TD>
<TD class="txtForml">
<input name="From" size="20" readonly="Yes"
value="<CFOUTPUT>#Session.user.email#</CFOUTPUT>">
</TD></TR>
<TR><TD
align="right" class="txtForml">
<A href="javascript:SelAddr('To', 'seladdr');" -
class="txtlink">To</A></TD><TD
class="txtForml">
<input name="To" size="56"
value="<CFOUTPUT>#to#</CFOUTPUT>">Snbsp;*</TD></TR>
<TR><TD "align="right" class="txtForm1">Subject</TD>
<TD class="txtForml"><input
name="Subject" size="56"
value="<CFOUTPUT>#subject#</CFOUTPUT>"X/TD></TR>
<TR><TD align="right" class="txtForml">
<A href="javascript:SelAddr{'Cc',
'seladdr');"
class="txtlink">Cc</A></TD><TD
class="txtForml">
<input name="Cc" size="56"
value="<CFOUTPUT>#ccl</CFOUTPUT>"></TD></TR>
<TR><TD
align="right" class="txtForml">
<A href="javascript:SelAddr('Вес',
'seladdr');"
class="txtlink">Bcc</A></TD><TD
class="txtForml">
<input name="Bcc"
size="56"
value="<CFOUTPUT>#bcc#</CFOUTPUT>"></TD></TR>
<TR><TD class="txtForml" colspan="2">
<textarea name="Body" rows="8"
cols="71"><CFOUTPUT>#body#
</CFOUTPUT></textarea></TD></TR>
<TR><TD align="right"
class="txtForml">Type</TD>
<TD class="txtForm1">
<input type="radio"
name="Type"
onClick="TypeClick('', 'basic')"
value=""<CFOUTPUT>#type1#
</CFOUTPUT>>plain
text
<input type="radio" name="Type"
onclick='.'TypeClick(
'HTML', 'basic') "
value="HTML"<CFOUTPUT>ltype2#
</CFOUTPUT>>html</TD></TR>
<TR><TD align="right"
class="txtForml">Attachmentl</TD><TD>
<input class="txtForml"
type="file"
name="attl"
size="36"></TD></TR>
<TR><TD al'ign="right"
class="txtForml">
Attachment2</TD><TD>
<input class="txtForml"
type="file"
name="att2"
size="36"></TD></TR>
<TR><TD
align="right" class="txtForml">Attachment3</TD><TD>
<input class="txtForml" type="file" name="att3"
size="36"></TD></TR>
<TR><TD align="right"><input type="submit"
value="Send"></TD><TD><input
type="reset" value="Clear">
<CFIF isDefined("URL.Draft")>
<input type="submit" value="Update Draft"
onClick="UDraft('basic')">
<CFELSE>
<input type="submit" value="Save Draft"
onClick="SDraft('basic')">
</CFIF>
<input type="Hidden"
name="SaveDraft" value="No">
<input type="Hidden" name="UpdateDraft" value="No">
<input type="Hidden" name="KeyBox"
value="<CFOUTPUT>#keybox#</CFOUTPUT>">
</TD></TR>
</TABLE>
</FORM>
<DIV ici="seladdr">
<p nIass="title">To/Cc/Bcc</p>
<i class="txt">
At change of
the block of pages or sorting the
parameters of
the letter are not kept!</i>
<CFIF isDefined("Order")
AND isDefined("Trend")>
<CFSET Order
= #Order# & ' ' & #Trend# >
<CFELSE>
<CFSET Order
= 'FirstN_Addr ASC'>
</CFIF>
<CFIF not
isDefined("Search")>
<CFSET Search
= ''>
</CFIF>
<CFQUERY
NAME="Addresses" DATASOURCE="#Application.dsn#">
SELECT Key_Addr, FirstN_Addr, LastN__Addr,
Company_Addr,
EMail_Addr, Phone_Addr
FROM Addresses
WHERE Addresses.Key_User
= #Session.user.id#
AND (FirstN_Addr
Like '%#Searcht%' OR LastN_Addr Like '%#Searchtt%'
OR Company_Addr Like '%#Search#%' OR EMail_Addr Like '%#Search#%')
ORDER BY #Order#
</CFQDERY>
<FORM action="newmail.cfm"
method="post" name="form3"
onSubmit="IsForm3(this,
'basic')">
<input name="Search" size="20"
value="<CFOUTPUT>#Search#</CFOUTPUT>">
<input type="submit" value="Search">
<input type="Button" value="Done"
onClick="javascript:Done('basic',
'seladdr');">
<input type="Button" value="Cancel"
onClick="javascript:Cancel();">
<input type="Hidden" name="field">
<input type="Hidden" name="Subject">
<input type="Hidden" name="To">
<input type="Hidden"
name="Cc">
<input type="Hidden"
name="Bcc">
<input type="Hidden"
name="Body">
<input type="Hidden"
name="Type">
</FORM>
<CFSET CurBlockPages
= 1>
<CFIF isDefined("URL.CurPage")>
<CFSET CurPage
= #URL.CurPage#>
<CFELSE>
<CFSET CurPage
= 1>'
</CFIF>
<CFIF isDefined("URL.StartPg") AND isDefined{"URL.EndPg")>
<CFSET StartPg
= #URL.StartPg#>
<CFSET EndPg
= #URL.EndPg#>
<CFELSE>
<CFSET StartPg
= 1>
<CFSET EndPg
= Application.PageRows>
</CFIF>
<TABLE border="0"
cellpadding="2" cellspacing="4">
<TR><TD colspan="6" class="txt" align="right">
Showing:
<CFSET CountPages =
Ceiling(Addresses.recordCount/Application.PageRows)>
<CFLOOP INDEX = "Pages" FROM = "1" TO = "#CountPages#">
<CFOUTPUT>
<CFSET StartP
= Pages*Application.PageRows-Application.PageRows+l>
<CFSET EndP = Pages*Application.PageRows>
<CFIF Pages eq CountPages>
<CFSET EndP
= Addresses.recordCount>
</CFIF>
<CFIF Pages eq CurPage>
#StartP#-#EndP#
<CFELSE>
<A
href="newmail.cfm?CurPage=#Pages#
&StartPg=#StartP#&EndPg=#EndP#SSearch=#S
earcht" class="txtlink">#StartP#-#EndP#</A>
</CFIF>
<CFIF Pages
neq CountPages>,</CFIF>
<CFIF Pages eq Application
.MaxLinePages*CurBlockPages>
<CFSET CurBlockPages = CurBlockPages + 1>
<br>
</CFIF>
</CFOUTPUT>
</CFLOOP>
</TD></TR>
<TR><TD colspan="6" bgcolor="#cbccbd"
height=l></TD></TR>
<TR>
<TD class="txt">To/Cc/Bcc</TD>
<TD class="txt">First
<A href="newmail.cfm?Order=FirstN_Addr&Trend=ASC">
<img src="asc.gif" alt="0rder by ASC" border='0'></A>
<A href="newmail.cfm?Order=FirstN_Addr&Trend=DESC">
<img src="desc.gif" alt="0rder by DESC"
border='0'></A>£nbsp;
</TD>
<TD class="txt">Last
<A href="newmail.cfm?Order=LastN__Addr&Trend=ASC">
<img src="asc.gif" alt="0rder by ASC" border='0'></A>
<A href="newmail.cfm?Order=LastN_Addr&Trend=DESC">
<img src="desc.gif" alt="0rder by DESC",
border=' 0 'X/A>
Snbsp;
</TD>
<TD class="txt">Company
<A href="newmail.cfm?Order=Company_Addr&Trend=ASC">
<img src="asc.gif" alt="0rder by ASC" border='0'></A>
<A href="newmail.cfm?Order=Company_Addr&Trend=DESC">
<img src="desc.gif" alt="0rder by DESC" border='0'></A> Snbsp;
</TD>
<TD class="txt">EMail
<A href="newmail.cfm?Order=EMail_Addr&Trend=ASC">
<img src="asc.gif" alt="0rder by ASC" border='0'></A>
<A href="newmail.cfm?Order=EMail_Addr&Trend=DESC">
<img src="desc.gif" alt="0rder by DESC" border='0'></A>
</TD>
<TD class="txt">Phone</TD>
</TR>
<TR><TD
colspan="6" bgcolor="#cbccbd" height=l></TD></TR>
<FORM method="post" name="form2">
<CFLOOP QUERY="Addresses"
STARTROW="#StartPg#" ENDROW="#EndPg#">
<TR>
<TD class="txt" align="center">
<input type="checkbox"
value="<CFOUTPUT>#EMail_Addr|</CFOOTPUT>"
name="<CFOUTPUT>#Key_Addrl</CFOUTPUT>"></TD>
<TD class="<CFIF FirstN_Addr does not
contain Search
OR Search eq
' '>txt<CFELSE>txtsearch</CFIF>">
<CFOUTPUT>#FirstN_Addr#</CFOUTPUT></TD>
<TD class="<CFIF LastN_Addr does
not contain Search
OR Search eq
' '>txt<CFELSE>txtsearch</CFIF>">
<CFOUTPUT>#LastN_Addr#</CFOUTPUT></TD>
<TD class="<CFIF Company_Addr does
not contain Search
OR Search eq
' '>txt<CFELSE>txtsearch</CFIF>">
<CFOUTPUT>#Company_Addr#</CFOUTPUT></TD>
<TD class="<CFIF EMail_Addr does
not contain Search
OR Search eq
' '>txt<CFELSE>txtsearch</CFIF>">
<A href="
javascript :DoneCur ( 'basic' ,
' seladdr ' , ' <CFOUTPUT># EMail_Addrtt
</CFOUTPUT>
' ) ; " class="txtlink">
<CFOUTPUT>#EMail_Addrl</CFOUTPUT></A></TD>
<TD class="txt"><CFOUTPUT>#Phone_
Addr#</CFOUTPUT></TD>
</TR>
</CFLOOP>
<TR><TD colspan="6" bgcolor="#cbccbd"
height=l></TD></TR>
<TR><TD colspan="5">
<A href =" javascript :SelectAll
( 'seladdr ');"
class="txtlink">
Select All</A>
,
<A href="javascript:UnselectAll( 'seladdr' )
; " class="txtlink">
Unselect All</A>
,
<A href=" javascript : InvertChecks
( 'seladdr ')
;" class="txtlink">
Invert Checks</A>
</TD></TR>
</TABLE>
</FORM>
</div>
<script>
if(ns) docu-
ment . layers [ ' basic ' ] .
document . f
orml . Type . value="<CFOUTPUT>#typeVal#
</CFOUTPUT>";
else document . f orml . Type .
value="<CFOUTPUT>#typeValt</CFOUTPUT>"
;
if(ns) document, layers [ 'seladdr' ]
.document .
formS . field. value="<CFOUTPUT>#field#
</CFOUTPUT>" ;
else document.form3.field.value="
<CFOUTPUT>#field#</CFOUTPUT>'
</Script>
</BODY>
</HTML>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;ORL=login.cfm">
</CFIF>
Листинг
П2.17. Код страницы addresses. cfm
<CFIF isDefined
("Session. user. name" )>
<HTML>
<HEAD>
<TITLE>Addresses</TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>#Application.
myBGColor#</cfoutput>">
<script type="text/javascript"
language="
JavaScript"
src="selectchecks
. js"></script>
<script>
function SelCheck
(block, delimiter, property) {
idxlen = SelUnsellnv
(block) ;
var strCheck
= "";
for (i=0;i<idxlen;i++) {
if(ns) {
if
(document. layers [block] .document
. form2 .elements
[i] .checked==true) {
if (strCheck=="")
(
eval ( "strCheck = document .
layers [block] . document. form2.
elements [i]
. "+property) ;
} else {
eval ("strCheck = strCheck +
delimiter +
docu-
ment . layers [block] . document.
form2. elements
[i] . "+property) ;
}
} else {
if (document. form2. elements (i)
. checked==true)
{
if (strCheck=='"r) {
eval ("strCheck = document .
form2 .elements
(i) . "+property) ;
} else {
eval ("strCheck = strCheck + delimiter +
document . form2 . elements (i) . "+property) ;
}
return strCheck;
}
function DeleteSelAddr (block) {
strCheck = SelCheck
(block, "," , "name");
if (strCheck
== "") {
alert ("For removal it is necessary
to select even
one address!")
} else {
eval ("window. location. href = 'delete-
seladdr . cfm?DelAddr="+strCheck+" "' ) ;
}
function NewMailSelAddr
(block) {
strCheck = SelCheck
(block, ";" , "value");
if (strCheck = "") {
alert ("For creation of the new
mail it is necessary
to select even
one address!");
} else {
eval ("window. location. href = 'newmail.
cfm?To="+strCheck+"
' ") ;
}
</script>
<DIV id="menu">
<TABLE width=440 border=0 cellpadding=0
cellspacing=0>
<TR valign="Middle">
<TDXspan clas5="txtmenustat">
<A href="mailbox.cfm" target="_top"
class="txtmenu"
onMouseOver="javascript:layerWrite
( 'prompt' ,null,
'<span
class=\'txtpromptX ' >Mail Box</span> ' ) ;
window. status='
Mail Box'; return true"
onMouseOut="javascript:layerWrite
( 'prompt ' /null,
' ') ;
window. status- ' ' ; return true">Mail
Box</A>
|
<A href="newmail.cfm" target="_top"
class="txtmenu"
OnMouseOver="
javascript : layerWrite ( 'prompt ' , null, ' <span
elass=\ ' txtpromptX ' >New Mail</span> ' ) ;
window. status='
New Mail1; return true"
onMouseOut=" javascript: layerWrite ( 'prompt' , null, ' ' ) ;
window. status=' '; return true">New Mail</A> I Snbsp;
AddressesSnbsp; |
<A href="logout.cfm"
target="_top" class="txtmenu"
onMouseOver=" javascript : layerWrite ( 'prompt ' , null, ' <span
class=\ ' txtpromptX ' >Log Out</span> ' ) ;
window. status='
Log Out'; return true"
onMouseOut=" javascript: layerWrite ( 'prompt' , null, ' ') ;
window. status= ' ' ; return true">Log Out</A>
</spanx/TD>
</TR>
</TABLE>
</div>
<DIV id="prompt"><span
class="txtprompt"x/spanx/DIV>
<DIV id="basic">
<p class="title">Addresses
<A href="edituser.cfm" class="txtlink">
<CFOUTPUT>#Session . user . name#</CFOUTPUTX/AX/p>
<CFIF igDefined(
"Order") AND isDefined( "Trend" )>
<CFSET Order
= #0rder# & ' ' & #Trend#>
<CFELSE>
<CFSET Order
= 'FirstN_Addr ASC'>
</CFIF>
<CFIF not isDefined( "Search" )>
<CFSET Search
= ">
</CFIF>
<CFQUERY NAME="Addresses" DATASOURCE="#Application.dsn#">
SELECT Key_Addr,
FirstN_Addr, LastN_Addr,
Company Addr,
EMail Addr, Phone Addr
FROM Addresses
WHERE Addresses.Key_User
= #Session.user.id#
AND (FirstN_Addr
Like '%tSearch#%' OR LastN_Addr Like '%#Searcht%'
OR Company_Addr Like '%#Search#%' OR EMail_Addr Like '%#Searchf%')
ORDER BY #0rder#
</CFQUERY>
<FORM action="addresses.cfm"
method="post" name="forml">
<input name="Search" size="20"
value="<CFOUTPUT>#Search#</CFOUTPUT>">
<input type="submit"
value="Search">
<input type="Button"
value="New Contact"
onClick="javascript:location.
href='addeditdel_addr.cfm?Type=Add'">
<input type="Button"
value="New Mail for Selected"
onClick="javascript:NewMailSelAddr('basic');">
</FORM>
<CFSET CurBlockPages
= 1>
<CFIF isDefined("URL.CurPage")>
<CFSET CurPage
= #URL.CurPage#>
<CFELSE>
<CFSET CurPage
= 1>.
</CFIF>
<CFIF isDefined("URL.StartPg") AND isDefined("URL.EndPg")>
<CFSET StartPg
= #URL.StartPg#>
<CFSET EndPg
= #URL.EndPg#>
<CFELSE>
<CFSET StartPg
= 1>
<CFSET EndPg
= Application.PageRows>
</CFIF>
<TABLE border="0" cellpadding="2" cellspacing="4">
<TRXTD colspan="7"
class="txt" align="right">
Showing:
<CFSET CountPages
=
Ceiling(Addresses.recordCount/Application.PageRows)>
<CFLOOP INDEX
= "Pages" FROM = "1" TO = "#CountPages#">
<CFOUTPUT>
<CFSET StartP = Pages*Application.
PageRows-Application.PageRows+l>
<CFSET EndP = Pages^Application.PageRows>
<CFIF Pages eq CountPages>
<CFSET EndP
= Addresses.recordCount>
</.CFIF>
<CFIF Pages eq CurPage>
#StartP#-#EndP#
<CFELSE>
<A href="addresses.cfm?CurPage=
#Pages#&StartPg=#StartP#&EndPg=#EndP#&Search=
#Search#" class="txtlink">#StartP#-#EndP#</A>
</CFIF>
<CFIF Pages
neq CountPages>,</CFIF>
<CFIF Pages eq Application.
MaxLinePages*CurBlockPages>
<CFSET CurBlockPages = CurBlockPages + 1>
<br>
</CFIF>
</CFOUTPUT>
</CFLOOP>
</TD></TR>
<TR><TD colspan="7" bgcolor="#cbccbd"
height=l></TD></TR>
<TR><TD class="txt">To</TD>
<TD class="txt">First
<A href="addresses.cfm?Order=FirstN
_Addr&Trend=ASC">
<img src="asc.gif" alt="0rder by
ASC" border='0'x/A>
<A href="addresses.cfm?Order=FirstN
_Addr&Trend=DESC">
<img src="desc.gif" alt="0rder by
DESC"
border='0'></A> Snbsp;</TD>
<TD class="txt">Last
<A href="addresses.cfm?Order=LastN
_Addr&Trend=ASC">
<img src="asc.gif" alt="0rder by
ASC" border='0'></A>
<A href="addresses.cfm?Order=LastN
_Addr&Trend=DESC">
<img src="desc.gif" alt="0rder by DESC"
border='0'></A>
</TD>
<TD class="txt">Company
<A href="addresses.cfm?Order=Company
_Addr&Trend=ASC">
<img src="asc.gif" alt="0rder by ASC"
border='0'></A>
<A href="addresses.cfm?Order=Company
_Addr&Trend=DESC">
<img src="desc.gif" alt="0rder by DESC"
border='0'></A> Snbsp;</TD>
<TD class="txt">EMail
<A href="addresses.cfm?Order=EMail_
Addr&Trend=ASC">
<img src="asc.gif" alt="0rder by ASC"
border='0'x/A>
<A href="addresses.cfm?Order=EMail_
Addr&Trend=DESC">
<img src="desc.gif" alt="0rder by DESC"
border='0'></A> Snbsp;</TD>
<TD class="txt">Phone</TD>
<TD class="txt"
align="center">Controls</TD>
</TR>
<TR><TD colspan="7" bgcolor="icbccbd"
height=lx/TDX/TR>
<FORM method=?"post" name="form2">
<CFIF Addresses.recordCount eq 0>
<TR><TD class="txt" colspan="7" align="center">
The address
book is empty</TDX/TR>
<CFELSE>
<CFl,OOP QUERY="Addresses" STARTROW="
#StartPg#"
ENDROW="#EndPg#">
<TR>
,<TD class="txt"Xinput type="checkbox"
value="<CFOUTPUT>#EMail_Addr#</CFOUTPUT>"
name="<CFOUTPUT>#Key_Addr#</CFOUTPUT>"
/TD>
<TD class="<CFIF FirstN_Addr does not
contain Search
OR
Search eq ''>txt<CFELSE>txtsearch</CFIF>">
<CFOUTPUT>#FirstN_Addr#</CFOUTPUTX/TD>
<TD class="<CFIF LastN_Addr does not
contain Search
OR
Search eq ''>txt<CFELSE>txtsearch</CFIF>">
<CFOUTPUT>iLastN_Addr#</CFOUTPUTX/TD>
<TD class="<CFIF Company_Addr does
not contain
Search OR
Search eq ''>txt<CFELSE>txtsearch</CFIF>">
<CFOUTPUT>#Company_Addr#</CFOUTPUT></TD>
<TD class="<CFIF EMail_Addr does not contain Search OR
Search eq ''>txt<CFELSE>txtsearch</CFIF>">
<A href="newmail.cfm?To=<CFOUTPUT>IEMail_Addr
#</CFOUTPUT>"
class="txtlink"XCFOUTPUT>#EMail_Addrtt
</CFOOTPUT></A></TD>
<TD class="txt"><CFOUTPUT>#Phone_Addr#
</CFOUTPUTX/TD>
<TD class="txt" align="center">
<A href="addeditdel_addr.cfm?Type=Edit&Key=<CFOUTPUT>
#Key_Addr#</CFOUTPUT>">
<img src="edit.gif" alt="Edit" border='0'x/A> Snbsp;
<A href="addcditdel_addr.cfm?Type=Delete&Key=<CFOUTPUT>
#Key_Addr#</CFOUTPUT>">
<imy srn="rtelete.gif"
alt="Delctc" border-1 01x/A></TD>
</TR>
</CFLOOP>
</CFIF>
<TR><TD
со!зрап="7" bgcolor="fcbccbd" height=l><:/TD></TR>
<TR><TD colspan="6">
<A href="javascript:SelectAll('basic');"
class="txtlink">Select All</A> ,
<A href="javascript:UnselectAll('basic');"
class="txtlink">Unselect All</A> ,
<A href="javascript:InvertChecks('basic');"
class="txtlink">Invert
Checks</A>
</TD>
<TD align="right">
<A href="javascript:DeleteSelAddr('basic');">
<img src="deletesel.gif" border='0' alt="Delete Selected"x/A>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login. cfm">
</CFIF>
Листинг
П2.18. Код страницы addeditdel_addr.cfm
<CFIF isDefinedf"Session.user.name")>
<HTML>
<HEA'D>
<TITLE><cfoutput>#Type#</cfoutput>
Addresses</TITLE>
</HEAD>
<BODY bgcolor="<CFOUTPUT>#Application.myBGColor#</CFOUTPUT>">
<DIV id="menu">
<TABLE width=440
border=0 cellpadding=0 cellspacing=0>
<TR valign="Middle"><TD><span class="txtmenustat">
<A href ="mailbox. cfm" target="_top" class="txtmenu"
onMouseOver=" javascript : layerWrite ( 'prompt ' , null,
'<span class=\'txtprompt\'>Mail
Box</span>';
window. status=' Mail Box'; return true"
onMouseOut=" javascript: layerWrite ( 'prompt' , null, ' ' ) ;
window. status= ' ' ; return true">Mail Box</A> | snbsp;
<A href="newmail.efm" target="_top" class="txtmenu"
onMouseOver=" javascript : layerWrite ( 'prompt ' , null,
'<span class=\'
txtprompt\ '>New Mail</span>';
window. status=' New Mail'; return true"
onMouseOut=" javascript: layerWrite ( 'prompt ', null, ' ') ;
window, status=' '; return true">New Mail</A> |
Addresses | Snbsp;
<A href="logout.cfm"
target="_top" class="txtmenu"
onMouseOver=" javascript: layerWrite ( 'prompt' , null,
'<span class=\'txtprompt\'>Log
Out</span>' ) ;
window. status=' Log Out'; return true"
onMouseOut="javascript:layerWrite ( 'prompt' , null, ' ') ;
window. status= ' ' ; return true">Log Out</A>
</span></TD>
</TR>
</TABLE>
</div>
<DIV id="prompt"xspan
class="txtprompt"></span></DIV>
<DIV id="basic">
<p class="title"><CFOUTPUT>#Type#</CFOUTPUT>
<A href="addresses . cfm">Addresses</A>
<A href ="edituser. cfm" class="txtlink">
<CFOUTPUT>#Session . user . namet</CFOUTPUT></A></p>
<CFIF isDefined("Form.EMail")>
<CFSET DIsuccessful = 1>
<CFSET msgError = "Warning Error! ">
<CFIF Len
(Form.EMail) le 5 and Form.EMail does not contain "@">
<CFSET msgError = msgError & "<br>" S #Application.msgErrorl#>
<CFSET DIsuccessful
= 0>
</CFIF>
<CFIF YesNoFormat(DIsuccessful) equal "No">
<!---Ошибки
(Errors)--->
<CFSET email
= #Form.EMail#>
<CFSET firstn - #Form.FirstN#>
<CFSET lastn = #Form.LastN#>
<CFSET comp = #Form.Company#>
<CFSET phone = #Form.Phone#>
<CFELSE>
<!--- Проверка
(Verification) --->
<CFIF Type
eq "Edit">
<!--- Редактирование
записи (Edit record) --->
<CFQUERY
NAME="EditAddr" DATASOURCE="#Application.dsn#">
UPDATE Addresses
SET EMail_Addr = '#Form.EMail#',
FirstN_Addr = '#Form.FirstN#',
LastN_Addr = '#Form.LastN#',
Company_Addr = '#Form.Company#',
Phone_Addr = '#Form.Phone#'
WHERE Key_Addr = #Key#
</CFQUERY>
<CFELSE>
<!--- Добавить
запись (Add record) --->
<CFQUERY
NAME="AddAddr" DATASOURCE="IApplication.dsn#">
INSERT INTO Addresses(Key_User, EMail_Addr, FirstN_Addr,
LastN_Addr,
Company_Addr, Phone_Addr)
VALUES(#Session.user.id#, '#Form.EMail#', '#Form.FirstN#',
'#Form.LastN#',
'#Form.Company*','fForm.Phone#')
</CFQUERY>
</CFIF>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=addresses.cfm">
<CFEXIT>
</CFIF>
<CFELSE>
<CFSWITCH
EXPRESSION=tType#>
<CFCASE VALUE="Edit">
<CFQUERY NAME="SetAddr" DATASOURCE="#Application.dsn#">
SELECT *
FROM Addresses
WHERE Key_Addr = #URL.Key#
</CFQUERY>
<CFLOOP QUERY="SetAddr">
<CF3ET email = #SetAddr.EMail_Addr#>
<CFSET firstn = #SetAddr.FirstN_Addr#>
<CFSET lastn = #SetAddr.LastN_Addr#>
<CFSET comp = #SetAddr.Company_Addr#>
<CFSET phone = #SetAddr.Phone_Addrf>
</CFLOOP>
</CFCASE>
<CFCASE VALUE="Add">
<CFSET email = "">
<CFSET firstn = "">
<CFSET .lastn = "">
<CFSET comp = "">
<CFSET phone = "">
</CFCASE>
<CFCASE VALUE="Delete">
<!--- Удалить
запись (Delete record) --->
<CFQUERY
NAME="DeleteAddr" DATASOURCE="#Application.dsnl">
DELETE * FROM
Addresses WHERE Key_Addr = #URL.Key#
</CFQUERY>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=addresses.cfm">
<CFEXIT>
</CFCASE>
</CFSWITCH>
</CFIF>
<FORM action="addeditdel_addr.cfm"
method="post" name="forml">
<TABLE width="300" border="0" cellspacing="2"
cellpadding="0">
<CFIF isDefined("msgError")>
<CFOUTPUT>
<TR><TD colspan="2" align="center" class="txtError">
#msgError#</TDX/TR>
</CFOUTPUT>
</CFIF>
<TRXTD align="right" class="txtForml">
First Name</TD><TD
class="txtForml">
<input nome="FirstN" size-"17"
value="<CFOUTPUT>#firstn#</CFOUTPOT>"></TD></TR>
<TR><TD align-"right" class="txtForml">
Last Name</TD><TD class="txtForml">
<input name="LastN" size="17"
value="<CFOUTPUT>#lastn#</CFOUTPUT>"></TD></TR>
<TR><TD align="right" class="txtForml">
Company</TD><TD width="215" class="txtForml">
<input name=" Company" size="25"
value="<CFOUTPUT>#comp#</CFOUTPUT>"></TD></TR>
<TRXTD align="right" class="txtForml">
E-Mail</TD><TD width="215" class="txtForml">
<input name="EMail" size="25"
value="<CFOUTPUT>#emailtt</CFOUTPUT>"> *</TD></TR>
<TR><TD align="right" class="txtForml">
Phone</TDXTD class="txtForml">
<input name="Phone" size="12"
value="<CFOUTPUT>#phone#</CFOUTPUT>"></TD></TR>
<TRXTD align="right">
<CFIF isDefined("URL.Key")>
<input type="Hidden" name="Key"
value="<CFOUTPUT>#URL.Keyt</CFOUTPUT>">
</CFIF>
<input type="Hidden" name="Type"
value="<CFOUTPUT>#Type#</CFOUTPUT>">
<input type="submit"
value="
<CFOUTPUT>#Type#</CFOUTPUT> "></TD><TD>
<input type="reset" value="Clear"></TD></TR>
</TABLE>
</FORM>
</BODY>
</HTHL>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login. cfm">
</CFIF>
Листинг
П2.19. Код страницы deletesel_addr.cfm
<CFIF isDefined("Session.user.name")>
<HTML>
<HEAD>
<TITLE>Delete
Select Addresses</TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>#Application.myBGColorl</cfoutput>">
<CFIF isDefined("URL.DelAddr")>
<CFQUERY
NAME="DeleteAddr" DATASOURCE="#Application.dsn#">
DELETE * FROM Addresses WHERE Key_Addr IN (ttURL.DelAddr#)
</CFQUERY>
</CFIF>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=addresses.cfm">
</BODY>
</HTML>
<CFELSE>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
</CFIF>
Листинг
П2.20. Код страницы logout.cfm
<CFSET Session.login
= "false">
<CFSET Session.user.id = 0>
<CFSET Session.user.name = "">
<CFSET Session.user.email = "">
<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=login.cfm">
<TITLE>Logout</TITLE>
</HEAD>
<BODY bgcolor="<cfoutput>#Application.myBGColort</cfoutput>">
</BODY>
</HTML>
Код страницы
help.cfm не рассматривается, т. к. ее содержание может быть
абсолютно произвольным.